return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
}
+static int svm_pae_enabled(struct vcpu *v)
+{
+ unsigned long cr4;
+
+ if(!svm_paging_enabled(v))
+ return 0;
+
+ cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
+
+ return (cr4 & X86_CR4_PAE);
+}
#define IS_CANO_ADDRESS(add) 1
hvm_funcs.realmode = svm_realmode;
hvm_funcs.paging_enabled = svm_paging_enabled;
hvm_funcs.long_mode_enabled = svm_long_mode_enabled;
+ hvm_funcs.pae_enabled = svm_pae_enabled;
hvm_funcs.guest_x86_mode = svm_guest_x86_mode;
hvm_funcs.instruction_length = svm_instruction_length;
hvm_funcs.get_guest_ctrl_reg = svm_get_ctrl_reg;
hvm_funcs.realmode = vmx_realmode;
hvm_funcs.paging_enabled = vmx_paging_enabled;
hvm_funcs.long_mode_enabled = vmx_long_mode_enabled;
+ hvm_funcs.pae_enabled = vmx_pae_enabled;
hvm_funcs.guest_x86_mode = vmx_guest_x86_mode;
hvm_funcs.instruction_length = vmx_instruction_length;
hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg;
}
else
#endif
- if ( hvm_get_guest_ctrl_reg(v, 4) & X86_CR4_PAE )
+ if ( hvm_pae_enabled(v) )
{
#if CONFIG_PAGING_LEVELS >= 3
// 32-bit PAE mode guest...
int (*realmode)(struct vcpu *v);
int (*paging_enabled)(struct vcpu *v);
int (*long_mode_enabled)(struct vcpu *v);
+ int (*pae_enabled)(struct vcpu *v);
int (*guest_x86_mode)(struct vcpu *v);
int (*instruction_length)(struct vcpu *v);
unsigned long (*get_guest_ctrl_reg)(struct vcpu *v, unsigned int num);
return hvm_funcs.long_mode_enabled(v);
}
+ static inline int
+hvm_pae_enabled(struct vcpu *v)
+{
+ return hvm_funcs.pae_enabled(v);
+}
+
static inline int
hvm_guest_x86_mode(struct vcpu *v)
{
#define VMX_LONG_GUEST(ed) \
(test_bit(VMX_CPU_STATE_LMA_ENABLED, &ed->arch.hvm_vmx.cpu_state))
+#define VMX_PAE_GUEST(ed) \
+ (test_bit(VMX_CPU_STATE_PAE_ENABLED, &ed->arch.hvm_vmx.cpu_state))
+
struct vmcs_struct {
u32 vmcs_revision_id;
unsigned char data [0]; /* vmcs size is read from MSR */
return VMX_LONG_GUEST(current);
}
+static inline int vmx_pae_enabled(struct vcpu *v)
+{
+ ASSERT(v == current);
+ return VMX_PAE_GUEST(current);
+}
+
/* Works only for vcpu == current */
static inline int vmx_realmode(struct vcpu *v)
{